﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace SaaS
{
    /// <summary>
    /// Summary description for checkOut
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class checkOut : System.Web.Services.WebService
    {

        [WebMethod]
        public string VerifyItems(string name)
        {
            double price = 5;
            int amount = int.Parse(name);
            price *=amount;
            return price.ToString();
        }

        [WebMethod]
        public string CalculateShippingCost(string address)
        {
            double cost = 2 + double.Parse(address);
            return cost.ToString();
        }

        [WebMethod]
        public string CalculateTotal(string amount)
        {
            return amount;
        }

        [WebMethod]
        public string Discount(string content)
        {
         /*   int ded = content.CompareTo("-");
            if (content.CompareTo("-")>0)
            {
                string[] total = {};
                total = content.Split('-');
                float temp = 0;
                temp = System.Convert.ToSingle(total[0]) * (1 - System.Convert.ToSingle(total[1])/100);
                return temp.ToString();
            }
            else
            {
                if (content.CompareTo("+") > 0)
            {
                string[] total = { };
                total = content.Split('+');
                float temp = 0;
                temp = System.Convert.ToSingle(total[0]) * (1 + System.Convert.ToSingle(total[1])/100);
                return temp.ToString();
            }
                else
                {
                    float temp = 0;
                    return temp.ToString();
                }
            }*/

            double total = double.Parse(content);
            total *= 0.85;
            return total.ToString();
        }

        [WebMethod]
        public string printMessage(string message)
        {
            string temp = "Total: ";
            return temp + message;
        }
    }
}
